package ObjectManager;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.*;

public class ObjectGame {
    public Sprite objSprite;
    public int width, height;
    public int currentX = 0, currentY = 0;
    public int objGameType = 0;
    public boolean xet=true;// kiem tra dung do neu gia tri la tru
    public ObjectGame(String imgSrc, int width, int height) {
        try{
            this.width = width;
            this.height = height;
            Image img = Image.createImage(imgSrc);
            objSprite = new Sprite(img, width, height);
            objSprite.setFrame(0);

        }
        catch(Exception ex){
            ex.printStackTrace();
        }
    }
    
    public ObjectGame(String imgSrc, int width, int height, int objGameType) {
        try{
            this.width = width;
            this.height = height;
            this.objGameType = objGameType;
            Image img = Image.createImage(imgSrc);
            objSprite = new Sprite(img, width, height);
            objSprite.setFrame(0);            
        }
        catch(Exception ex){
            ex.printStackTrace();
        }
    }
    
    public void SetCurrentX(int x){
        this.currentX = x;
        objSprite.setPosition(x, this.currentY);
    }
    
    public void SetCurrentY(int y){
        this.currentY = y;
        objSprite.setPosition(this.currentX, y);
    }
    
    public void SetCurrentPos(int x, int y){
        this.currentX = x;
        this.currentY = y;
        objSprite.setPosition(x, y);
    }
}
